package com.wc.alorithm_blue_bridge._前缀和与差分.Q1276;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.StreamTokenizer;
import java.util.LinkedList;

/**
 * @Author congge
 * @Date 2023/10/28 18:21
 * @description 小明的彩灯
 * https://www.lanqiao.cn/problems/1276/learning/?page=1&first_category_id=1&sort=students_count&second_category_id=8
 */
public class Main {
    public static void main(String[] args) {
        Input sc = new Input();
        int n = (int) sc.nextLong();
        int q = (int) sc.nextLong();
        long[] lights = new long[n + 1];
        for (int i = 1; i <= n; i++) {
            lights[i] = sc.nextLong();
        }
        LinkedList<Integer> lr = new LinkedList<>();
        LinkedList<Long> strength = new LinkedList<>();
        while (q-- > 0) {
            int l = (int) sc.nextLong();
            int r = (int) sc.nextLong();
            long x = sc.nextLong();
            int size = lr.size();
            if (size == 0) {
                lr.add(l);
                lr.add(r);
                strength.add(x);
            } else {
                for (int i = 0; i < size; i += 2) {
                    int curL = lr.get(i);
                    int curR = lr.get(i + 1);
                    if (r <= curL) {
                        if (r == curL) {
                            lr.set(i, curL + 1);
                            lr.add(i, r);
                            lr.add(i, r);
                            strength.add(i / 2, x + strength.get(i / 2));
                            if (l != r) {
                                lr.add(i, r - 1);
                                lr.add(i, l);
                                strength.add(i / 2, x);
                            }
                        } else {
                            lr.add(i, r);
                            lr.add(i, l);
                            strength.add(i / 2, x);
                        }
                        break;
                    }
                    if (l < curL) {
                        if (r < curR) {
                            lr.set(i + 1, r + 1);
                            lr.add(i, r);
                            lr.add(i, curL);
                            strength.add(i / 2, x + strength.get(i / 2));
                            lr.add(i, curL - 1);
                            lr.add(i, l);
                            strength.add(i / 2, x);
                            break;
                        } else {
                            strength.set(i / 2, x + strength.get(i / 2));
                            lr.add(i, curL - 1);
                            lr.add(i, l);
                            strength.add(i / 2, x);
                            if (r != curR) {
                                l = curR + 1;
                                i += 2;
                                size += 2;
                                continue;
                            }
                            break;
                        }
                    }
                    if (l >= curL && r <= curR) {
                        if (l == curL && r == curR) {
                            strength.set(i / 2, x + strength.get(i / 2));
                            break;
                        }
                        if (l == curL) {
                            lr.set(i, r + 1);
                            lr.add(i, r);
                            lr.add(l);
                            strength.add(i / 2, x + strength.get(i / 2));
                            break;
                        }
                        if (r == curR) {
                            lr.set(i + 1, l - 1);
                            if (i + 2 == size) {
                                lr.add(l);
                                lr.add(r);
                                strength.add(x + strength.get(i / 2));
                            } else {
                                lr.add(i + 2, r);
                                lr.add(i + 2, l);
                                strength.add(i / 2 + 1, x + strength.get(i / 2));
                            }
                            break;
                        }
                        long curX = strength.get(i / 2);
                        lr.set(i, r + 1);
                        lr.add(i, r);
                        lr.add(i, l);
                        strength.add(i / 2, x + curX);
                        lr.add(i, l - 1);
                        lr.add(i, curL);
                        strength.add(i / 2, curX);
                        break;
                    }

                    if (l <= curR && r > curR) {
                        if (l == curR) {
                            lr.set(i + 1, curR - 1);
                            if (i + 2 == size) {
                                lr.add(l);
                                lr.add(l);
                                strength.add(x + strength.get(i / 2));
                            } else {
                                lr.add(i + 2, l);
                                lr.add(i + 2, l);
                                strength.add(i / 2 + 1, x + strength.get(i / 2));
                            }

                        } else {
                            lr.set(i + 1, l - 1);
                            if (i + 2 == size) {
                                lr.add(l);
                                lr.add(curR);
                                strength.add(x + strength.get(i / 2));
                            } else {
                                lr.add(i + 2, l);
                                lr.add(i + 2, curR);
                                strength.add(i / 2 + 1, x + strength.get(i / 2));
                            }
                        }
                        l = curR + 1;
                        i += 2;
                        size += 2;
                    }
                }
                int curR = lr.get(lr.size() - 1);
                /**
                 * 还有剩余
                 */
                if (l > curR) {
                    lr.add(l);
                    lr.add(r);
                    strength.add(x);
                }
            }
        }

        int size = strength.size();
        for (int i = 0; i < size; i++) {
            int l = lr.get(i * 2);
            int r = lr.get(i * 2 + 1);
            long x = strength.get(i);
            while (l <= r) {
                lights[l] += x;
                ++l;
            }
        }
        StringBuffer ans = new StringBuffer();
        if (lights[1] < 0) {
            lights[1] = 0;
        }
        ans.append(lights[0]);
        for (int i = 2; i <= n; i++) {
            ans.append(' ');
            if (lights[i] < 0) {
                lights[i] = 0;
            }
            ans.append(lights[i]);
        }
        System.out.println(ans);
    }

    static class Input {
        StreamTokenizer in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));

        public long nextLong() {
            try {
                in.nextToken();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return (long) in.nval;
        }
    }
}
